package com.thingsgrid.device.service;


import com.thingsgrid.device.dto.DeviceDTO;
import com.thingsgrid.device.dto.TopicDTO;
import com.thingsgrid.device.entity.Device;
import com.thingsgrid.device.entity.Shadow;
import org.springblade.core.tool.api.R;

import java.sql.Timestamp;
import java.util.List;
import java.util.Map;

/**
 * 服务类
 *
 * @author BladeX
 * @since 2019-08-19
 */
public interface IDeviceService {
	/**
	 * 产品新增
	 */
	Device saveDevice(Device device);


	void addSlaveDevice(String slaveId, String deviceId);

	long removeSlaveDevice(String slaveId);

	//查询子设备列表
	Map<String,Object> listSlaveDevices(String deviceId, Integer currentPage, Integer size);

	List<Shadow> listDeviceShadow(String deviceId);

	/**
	 * 删除产品
	 */
	long removeDevice(String deviceId);

	/**
	 * 产品修改
	 */
	void updateDevice(Device device);

	/**
	 * 根据Id产品信息
	 */
	Map<String, Object> findDeviceById(String deviceId);

	/**
	 * 查找所有产品信息
	 *
	 * @return
	 */
	List<Device> findAll();

	/**
	 * 分页查找
	 */
	Map<String, Object> findAll(Integer pageIndex, Integer pageSize);

	/**
	 * 根据条件查
	 */
	Map<String,Object> selectByCondition(String deviceName, String productPointType, Timestamp beginTime, Timestamp endTime,
                                   Integer stats,Integer current,Integer size);

	/**
	 * 根据DeviceSn查找设备信息
	 */
	Device findDeviceByDeviceSn(String deviceSn);

	/**
	 *说明：查询topic列表
	 *@author lilongfei
	 *@since 2019/9/19 17:29
	 */
	Map<String,Object> getTopicListByDeviceId(String deviceId,Integer currentPage,Integer size);


	/**
	 *说明：查询可关联设备列表
	 *@author lilongfei
	 *@since 2019/9/26 14:46
	 */
	Map<String,Object> getRelevanceDeviceList(Integer page,Integer size,String deviceId);

	/**
	 *说明：关联设备
	 *@author lilongfei
	 *@since 2019/9/26 15:24
	 */
	long connectDevice(String deviceId,String slaveId);

	/**
	 *说明：通过产品id查询设备列表
	 *@author lilongfei
	 *@since 2019/9/27 14:22
	 */
	List<Device> getDeviceListByProductId(String productId);

	/**
	 *说明：设备发布
	 *@author lilongfei
	 *@since 2019/9/29 14:18
	 */
	R devicePublish(String deviceId, String publishState);


}
